<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<%@ include file="/pub/head_latest.inc"%>
	<script src="${baseURL}/themes/plugin/ligerUI_latest/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
	<title>元数据管理</title>
	<style>
		html{
			overflow: hidden;
		}
		
		.l-menu-item-icon {
		    left: 6px;
		    top: 3px;
		    position: absolute;
		    width: 14px;
		    height: 14px;
		    overflow: hidden;
		}
		
		.l-menu-item{
			position: relative;
		    height: 23px;
		    line-height: 23px;
		    width: 100%;
		    cursor: pointer;
		 }
		 
		 .l-layout-left,.l-layout-center,#framecenter,.l-tab-content,.l-tab-content-item,#accordionFrame,.l-accordion-content{
		 	height: 100% !important;
		 }
	</style>
	<script type="text/javascript">
            var tree = null;           
            var currentNodeId = "ROOT";
            $(function(){
                 //布局
                $("#layoutFrame").ligerLayout({ leftWidth: 190, height: '100%', space:2});
				var height = $("#layoutFrame").height() || 477;
				 //Tab
                var tab = $("#framecenter").ligerTab({ height: height });
                //面板
                var accordion = $("#accordionFrame").ligerAccordion({ height: height - 5, speed: null });
                //使树结构的标头不显示
                $(".l-accordion-header").height("0px");
                $(".l-tab-links").remove();
                
                var menu;
                var actionNodeID;
                function itemclick(item, i)
                {
                	 if(item.text == '增加'){
		                $("#contentFrame").attr("src", "${baseURL}/report/metadataexpression/metadataexpressionedit/edit.do?pid="+actionNodeID+"&csId=${csId}");
                	 }
                	 if(item.text == '删除'){
                		  $.ajax({
                			   	type: "GET",
             					url: "${baseURL}/report/metadataexpression/metadataexpressiondelete/delete.do",
             					dataType : "json",
             					data: "ids="+actionNodeID,
             					beforeSend: function (){
	          		                LG.loading = true;
	          		                LG.showLoading('删除中...');
	          		            },
	          		            complete: function (){
	          		                LG.loading = false;	  
	          		                LG.hideLoading();
	          		            },
             					success: function(msg){
	               					if(msg && msg.hasOk){
	               						parent.tab.reload("titlesParamsTab");
	               						alert('操作成功!');
	               					}else{
	           						 	alert("操作失败，原因如下:\n"+msg.message+"\n请联系系统管理员!");
	               					}
             					}
                		  });
                	 }
                 }
                
                var menu = $.ligerMenu({ top: 100, left: 100, width: 120, items:
	                    [
		                    { text: '增加', click: itemclick, icon: 'add' },
		                    { line: true },
		                    { text: '删除', click: itemclick, icon: 'delete' }
	                    ]
                    }
                );
                
                //使左栏列表标头也不显示
                $("#framecenter .l-tab-links").height("0px");
  				 tree = $("#tree1").ligerTree({
 			 			url: '${baseURL}/report/metadataexpression/metadataexpressiontree/tree.do?csId=${csId}&currentNodeId=${currentNodeId}', 
  					    checkbox: false,
 					 	idFieldName :'id',
            			parentIDFieldName :'pid', 
            			textFieldName : "name",
            			attribute : ['id', 'name', 'pid'],
            			onSelect: function (node){	             
 					 		//获得节点ID值
		                    var nodeId = node.data.id;
 					 		if(node.data.code == 'ROOT')
 			                    $("#contentFrame").attr("src", "${baseURL}/report/metadataexpression/metadataexpressionedit/help.do");
 					 		else{
 					 			//如果ID值为
 			                    if(currentNodeId === nodeId) return false;
 			           	        //显示右边列表
 			                    //contentFrame.FF_Reload(node.data);
 			                    $("#contentFrame").attr("src", "${baseURL}/report/metadataexpression/metadataexpressionedit/edit.do?id="+nodeId+"&csId=${csId}");
 					 		}
 					  },
		                 onContextmenu: function (node, e){
		                	 actionNodeID = node.data.id;
		                     menu.show({ top: e.pageY, left: e.pageX });
		                     return false;
		                 },
		                 onSuccess: function(data) {
		                	 $("#tree1").find(".l-expandable-close").click(); // 展开全部	
		                 }
 					 });
                $("#pageloading").hide();
            });
	</script>
</head>
<body>
	<div id="pageloading"></div>
	<!-- BODY!!! -->
	<!-- 左边菜单!!! -->
	<div id="layoutFrame" style="width:99.2%; margin:0 auto;">
		<div position="left" title="表头设计器" id="accordionFrame">
			<div title="(该标头隐藏不显示)" class="l-scroll">
				<ul id="tree1" style="margin-top:3px;"></ul><br/><br/>
			</div>                 
        </div>
		<!-- 右边内容!!! -->
		<div position="center" id="framecenter" >
			<div tabid="tabContent" title="列表页面不显示标头" >
			<!-- 包含列表页面 -->
				<iframe frameborder="0" name="contentFrame" id="contentFrame" src="${baseURL}/report/metadataexpression/metadataexpressionedit/help.do"></iframe>
			</div>
		</div>
	</div>
</body>
</html>

